<template>
  <div class="secondNav">
    <div class="secondNavWrap">
      <div class="logo-wrapper">
        <div class="left-user">
          <img src="../assets/logo@2x.png" class="logo">
          <h1>雅思真题和模拟考试平台</h1>
        </div>
        <div class="right-user">
          <h1>欢迎您：{{userInfo.userName}}</h1>
          <div class="loginout" @click="loginout">退 出</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'nav1',
    data() {
      return {
        userInfo: {}
      }
    },
    methods: {
      loginout() {
        this.$router.push('/login');
        localStorage.token = '';
      }
    },
    created() {
      this.userInfo = JSON.parse(localStorage.userInfo);
    }
  }

</script>

<style lang="less">
  .secondNav {
    width: 100%;
    min-width: 1200px;
    height: 70px;
    background: #fff;

    .secondNavWrap {
      width: 1200px;
      margin: 0 auto;
      position: relative;
      line-height: 70px;
    }

    .logo-wrapper {
      width: auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid #383838;

      .left-user {
        display: flex;
        align-items: center;
      }

      h1 {
        color: #383838;
        font-weight: bold;
      }

      .logo {
        height: 60px;
        margin-right: 15px;
      }

      .right-user {
        display: flex;
        align-items: center;

        .loginout {
          text-decoration: underline;
          color: #383838;
          font-size: 14px;
          margin-left: 15px;
          cursor: pointer;
        }
      }
    }
  }

</style>
